package com.rkc.feign;

import com.rkc.request.LockCouponRecordRequest;
import com.rkc.utils.JsonData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author `RKC`
 * @date 2021/11/12 16:57
 */
@FeignClient(name = "shopping-coupon-service", path = "/api/coupon_record/v1")
public interface CouponRecordFeignService {

    /**
     * 查询用户的优惠券是否可用
     * @param id
     * @return
     */
    @GetMapping("detail/{record_id}")
    JsonData findUserCouponRecordById(@PathVariable("record_id") long id);

    /**
     * 发起远程调用锁定优惠券
     * @param lockCouponRecordRequest
     * @return
     */
    @PostMapping("lock_records")
    JsonData lockCouponRecords(@RequestBody LockCouponRecordRequest lockCouponRecordRequest);
}
